
// let pathSecure = "/sdcard/xml_iles/3.txt";
// files.ensureDir(pathSecure);
// sleep(100);
// shell("cp /data/system/users/0/settings_secure.xml " + pathSecure, true);
// sleep(1000);
// console.log(files.exists(pathSecure));
// console.log(typeof pathSecure)
// const xmlSecure = open(pathSecure, "r");
// sleep(1000);
// const xmlArray = xmlSecure.read();
// sleep(1000);
// console.log("读到的字符串：", xmlArray);
// // xmlArray.forEach(element => {
// //     if (element.indexOf("android_id") > -1) {
// //         const androidId = element.match(/value="[a-z 0-9]*/g).split('"')[1];
// //         console.log(androidId);
// //     }
// // });

// xmlSecure.close();


function WebsocketHeartbeatJs({
    url,
    pingTimeout,
    pongTimeout,
    reconnectTimeout,
    pingMsg,
    repeatLimit
}) {
    this.opts = {
        url: url,
        pingTimeout: pingTimeout,
        pongTimeout: pongTimeout,
        reconnectTimeout: reconnectTimeout,
        pingMsg: pingMsg,
        repeatLimit: repeatLimit
    };
    this.ws = null;//websocket实例
    this.repeat = 0;

    //override hook function
    this.onclose = () => { };
    this.onerror = () => { };
    this.onopen = () => { };
    this.onmessage = () => { };
    this.onreconnect = () => { };

    this.createWebSocket();
}